package com.seecen.cywbackend.mapper;

import com.seecen.cywbackend.pojo.Dynamic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* @author lenovo
* @description 针对表【t_dynamic(圈子消息表)】的数据库操作Mapper
* @createDate 2025-03-21 16:26:00
* @Entity com.seecen.cywbackend.pojo.Dynamic
*/
public interface DynamicMapper extends BaseMapper<Dynamic> {

    @Update("update t_dynamic set like_count = like_count - 1 where id = #{dynamicId}")
    void decrementLikeCount(Integer dynamicId);

    @Update("update t_dynamic set like_count = like_count + 1 where id = #{dynamicId}")
    void incrementLikeCount(Integer dynamicId);

    @Update("update t_dynamic set favorite_count = favorite_count + 1 where id = #{dynamicId}")
    void incrementFavoriteCount(Integer dynamicId);

    @Update("update t_dynamic set favorite_count = favorite_count - 1 where id = #{dynamicId}")
    void decrementFavoriteCount(Integer dynamicId);

    @Update("update t_dynamic set comment_count = comment_count + 1 where id = #{dynamicId}")
    void incrementCommentCount(Integer dynamicId);
}


